#!/bin/bash
source /etc/profile
source activate python27

mkdir /home/marvin/daily_job/logs/`date +%Y-%m-%d`

# 先校验中间库数据是否完整
python /home/marvin/daily_job/py_job/sqlserver_check.py >>/home/marvin/daily_job/logs/`date +%Y-%m-%d`/sqlserver_check.log 2>&1
echo "------------------------------------------------------------------------"
start=`date +%s`
echo "开始数据抽取，start dailysqoop"`date +"%Y-%m-%d %H:%M"`
sh /home/marvin/daily_job/sqoop/dailysqoop.sh >>/home/marvin/daily_job/logs/`date +%Y-%m-%d`/dailysqoop.loglog 2>&1
dailysqoop_end=`date +%s`
usetime=`expr $dailysqoop_end - $start`
echo "数据抽取结束，end dailysqoop,usetime:$usetime"

cd /home/marvin/hive-1.1.0-cdh5.6.0

bin/hive -f /home/marvin/daily_job/hive/before.hql
bin/hive -f /home/marvin/daily_job/hive/pos.hql -d dt=$day
sleep 1m
bin/hive -f /home/marvin/daily_job/hive/posvip.hql
bin/hive -f /home/marvin/daily_job/hive/b.hql
